package com.zhouyu;

import com.zhouyu.common.Invocation;
import com.zhouyu.protocol.HttpClient;
import com.zhouyu.proxy.ProxyFactory;

import java.io.IOException;

/**
 * @author zzy
 */
public class Consumer {

    public static void main(String[] args) throws IOException {

        // 获取HelloService的代理对象
        HelloService helloService = ProxyFactory.getProxy(HelloService.class);
        // 调用代理对象的方法
        String result = helloService.sayHello("zhouyu123123123");
        // 打印结果
        System.out.println(result);


//        Invocation invocation = new Invocation(HelloService.class.getName(), "sayHello", new Class[]{String.class}, new Object[]{"zhouyu123123123"});
//        HttpClient httpClient = new HttpClient();
//        String result2=httpClient.send("localhost", 8080, invocation);
//        System.out.println(result2);

    }
}
